<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ include file="/WEB-INF/jsp/common/_includes.jsp" %>
<jsp:include page="/WEB-INF/jsp/common/_head.jsp"/>
<style  type="text/css">

.oText{border:1px dotted #ff0000;ryo:expression(onfocus=function light (){with(document.all.oText){style.borderColor=(style.borderColor=="#ffee00"?"#ff0000":"#ffee00");timer=setTimeout(light,500);}},onblur=function(){this.style.borderColor="#ff0000";clearTimeout(timer)})};

</style>
<div class="ui grid">
	<div class="row">
		<div class="column">
			<div class="ui two column grid">
				<div class="three wide column">
					<jsp:include page="/WEB-INF/jsp/common/_sidebar.jsp">
						<jsp:param name="index" value="103"/>
					</jsp:include>
				</div>
				<div id="container" class="thirteen wide column">
					<ol class="breadcrumb">
						<li><a href="/">后台管理</a></li>
						<li><a href="/support/userList">会员管理</a></li>
						<li class="active">代理商列表</li>
					</ol>
                    <form class="" role="search">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="clearfix">
                                <div class="form-group w500 pull-left">
                                    <input type="text" class="form-control" name="kw" value="${not empty param.kw ? param.kw : ''}" placeholder="请输入手机或邮箱或邀请码">
                                </div>
                                <button type="submit" class="btn btn-default ml10">搜索</button>
                                </div>
                                <div class="mt5 pull-left">
                                    <span>状态：</span>
                                    <a class="btn btn-${auditStatus == -1 ? 'success':'default'}" value="-1" href="/support/-1/proxyList?kw=${param.kw}">全部</a>
                                    <a class="btn btn-${auditStatus == 0 ? 'success' :'default'}"  href="/support/0/proxyList?kw=${param.kw}">待审核</a>
                                    <a class="btn btn-${auditStatus == 1 ? 'success' :'default'}"  href="/support/1/proxyList?kw=${param.kw}">审核通过</a>
                                    <a class="btn btn-${auditStatus == 2 ? 'success' :'default'}"  href="/support/2/proxyList?kw=${param.kw}">审核未通过</a>
                                </div>
                            </div>
                        </div>
                    </form>

					<table class="table table-hover">
						<thead>
						<tr>
							<th>ID</th>
							<th>真实姓名</th>
							<th>电话</th>
							<th>邮箱</th>
							<th>公司名称</th>
							<th>审核状态</th>
							<th>申请时间</th>
							<th>更改时间</th>
                            <th>操作</th>
                            <th>备注</th>
						</tr>
						</thead>
						<tbody>
						<c:forEach items="${paginate.pageList}" var="userCompany">
							<tr>
								<td><a href="/support/authentication/${userCompany.userId}" target="_blank">${userCompany.id}</a></td>
								<td>${userCompany.name}</td>
								<td>${userCompany.mobilePhone}</td>
								<td>${userCompany.email}</td>
								<td>${userCompany.companyName}</td>
								<td>
								    <c:choose>
                                        <c:when test="${userCompany.auditStatus == 2}">
                                            	审核未通过
                                        </c:when>
                                        <c:when test="${userCompany.auditStatus == 1}">
                                            	审核通过
                                        </c:when>
                                        <c:otherwise>
                                            	待审核
                                        </c:otherwise>
								    </c:choose>
                                </td>
                                <td><fmt:formatDate value="${userCompany.createTime}" pattern="yyyy-MM-dd hh:mm:ss"/></td>
                                <td><fmt:formatDate value="${userCompany.updateTime}" pattern="yyyy-MM-dd hh:mm:ss"/></td>
								<td> 
									<a class="btn btn-info js_broadcast" href="/support/proxyView/${userCompany.id}" target="_blank">详情</a>
									<c:if test="${userCompany.auditStatus == 0}">
										<a class="btn active btn-success"  isAudit="true"  label="确认继续此操作？" title="操作提示" ref="/support/updateAuditStatus/1/${userCompany.userId } " href="javaScript:;">审核通过</a>
                                		<a class="btn active btn-danger jq_link" data-toggle="modal" data-target="#myModal" rel="${userCompany.id }" userId="${userCompany.userId}">审核不通过</a>
									</c:if>
									<c:if test="${userCompany.auditStatus == 1}">
                                		<a class="btn active btn-danger jq_link" data-toggle="modal" data-target="#myModal" rel="${userCompany.id }" userId="${userCompany.userId}">审核不通过</a>
									</c:if>
									<c:if test="${userCompany.auditStatus == 2}">
										<a class="btn active btn-success"  isAudit="true"  label="确认继续此操作？" title="操作提示" ref="/support/updateAuditStatus/1/${userCompany.userId } " href="javaScript:;">审核通过</a>
									</c:if>
								</td> 
								 <td><input  type="hidden" value=${userCompany.remark} name=${userCompany.remark} id="hiloo"/>  
								   <c:choose>  
								   <c:when test="${ empty userCompany.remark}">
								    <button class="btn btn-primary btn-lg" data-toggle="modal"  style="font-size: 14px;font-weight: normal;padding: 7px 5px ;"  data-target="#myModal1"   onclick="locking(${userCompany.userId })">添加备注 </button>				</td>
								   </c:when>
								   <c:otherwise>
								   <button class="btn btn-success btn-lg" data-toggle="modal"  style="font-size: 14px;font-weight: normal;padding: 7px 5px ;"  data-target="#myModal2"  onclick="locking1(this)">查看备注 </button>				</td>
								    </c:otherwise>
								   </c:choose>   
								 
								  </td>
							</tr>
						</c:forEach>
						</tbody>  
					</table>
                    <div class="page-info clearfix">
                        <jsp:include page="/WEB-INF/jsp/common/_page.jsp"/>
                    </div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- Modal begin -->
<form action="/support/disAgreeAply" method="post" id="addForm">
	<input type="hidden" value="" id="userId" name="userId"/>
	<input type="hidden" value="" id="userCompanyId" name="userCompanyId"/>
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="margin-top:50px;">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title" id="myModalLabel">审核不通过原因</h4>
	      </div>
	      <div class="modal-body">
	      	<div class="form-group">
				<label for="reasonContent">原因</label>
				<textarea class="form-control" name="reasonContent" id="reasonContent" placeholder="请输入原因" cols="2" rows="3"></textarea>
			</div>
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	        <button type="submit" class="btn btn-primary">提交</button>
	      </div>
	    </div>
	  </div>
	</div>
</form>
<!-- 模态框（Modal） -->
<div class="modal fade oText" id="myModal1" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true"  style="border: 10px;border-color: aqua;">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" 
               data-dismiss="modal" aria-hidden="true">  
                  &times;
            </button>
            <h4 class="modal-title" id="myModalLabel">
            添加备注:
            </h4>
         </div>      
         <div class="modal-body">
           <form action="/support/beizhu"   id="beizhuTJ"   method="post"> 
              <textarea rows="3" cols="60"   id="neirong"   name="neirong"   maxlength="150"></textarea>
              <input   type="hidden"  name="userCompanyid"   id="userCompanyid"/>
           </form> 
         </div>    
         <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal">关闭  
            </button>
            <button type="button" class="btn btn-primary"    onclick="beizhuTJ()">
               提交更改
            </button>
         </div>
      </div><!-- /.modal-content -->
</div><!-- /.modal -->
 </div>
<!-- 模态框（Modal） -->
<div class="modal fade form-group   " id="myModal2" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
  
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" 
               data-dismiss="modal" aria-hidden="true">
                  &times;
            </button>
            <h4 class="modal-title" id="myModalLabel">
           备注:
            </h4>
         </div>      
         <div class="modal-body">
              <textarea rows="3" cols="50"   id="xx"   name="neirong"   maxlength="100"></textarea>
              <input   type="hidden"  name="userCompanyid"   id="userCompanyid"/>
         </div>      
      </div><!-- /.modal-content -->  
</div><!-- /.modal -->
 </div>
<jsp:include page="/WEB-INF/jsp/common/_foot.jsp"/>
<script type="text/javascript" src="/static/vendor/jquery.validate/jquery.validate.js"></script>
<script type="text/javascript" src="/static/js/support/proxylist.js"></script>
<script type="text/javascript">
$(function() {
	$("#addForm").validate({
		rules : {
			reasonContent : 'required'
		},
		messages : {
			reasonContent : {
				required : "请输入原因！"
			}
		}
	});
	
	$(".jq_link").click(function() {
	    var id = $(this).attr('rel');
	    var userId = $(this).attr('userId');
	    $("#userCompanyId").val(id);
	    $("#userId").val(userId);
  	});
});


function  locking(obj){
// 	alert(obj)
	 $("#userCompanyid").val(obj); 
};
function  locking1(obj){
// 	alert($(obj).prev("#hiloo").attr("name"));
var  dd = $(obj).prev("#hiloo").val();
	 $("#xx").val(dd);  
}
function  beizhuTJ(){ 
	var   neirong =$("#neirong").val();
	if(neirong==""){
		alert("请输入备注内容");
		return false  ;  
	}
	document.getElementById("beizhuTJ").submit();
	}  
</script>

 